import request from '@/utils/axios'

import routers from '@/router/routers'// 这是 获取路由里面的路由数组（公共组件）
import { getMenuByRouter } from '@/utils/util' //格式化路由

// 退出登录
export const logout = (param) => {
  return request.get('/sysUser/logoutUser', {})
}

// 密码登录
export const passLogin = async (param) => {
  return request.post('/sysUser/loginUser', param)
}
// 获取左侧路由 菜单
export function AdminMenuList(params) {
  return request.post('/sysPackage/listPackages', params)

  // return request.post('zr/admin_menu_list/', params)
  // const list = getMenuByRouter(routers)
  // return new Promise((resolve, reject) => {
  //   setTimeout(() => {
  //     resolve({
  //       code: 1,
  //       msg: "成功",
  //       data: list
  //     })
  //   }, 1000)
  // })
}

// 获取用户列表
export function AdminUserList(data) {
  return request.post('/sysUser/pageListUsers', data)
}
// 新增用户
export function AdminUserAdd(data) {
  return request.post('/sysUser/registerUser', data)
}
// 编辑用户
export function AdminUserEdit(data) {
  return request.post('/sysUser/updateUser', data)
}
// 删除用户
export function AdminUserDelete(params) {
  return request.get('/sysUser/deleteUser', {params:params})
}
